/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package server.so.vezbac;

import domen.OpstiDomenskiObjekat;
import domen.Vezbac;
//import java.sql.SQLException;
//import java.util.logging.Level;
//import java.util.logging.Logger;
import server.baza.DataBaseBroker;
import server.so.OpstaSO;

/**
 *
 * @author Ivan Ivic
 */
public class VratiVezbaca extends OpstaSO {
    private Vezbac vezbac;

    public Vezbac getVezbac() {
        return vezbac;
    }

    public void setVezbac(Vezbac vezbac) {
        this.vezbac = vezbac;
    }
    
    
    public synchronized static Vezbac vratiVezbaca(int VezbacID)
    {
        VratiVezbaca vv = new VratiVezbaca();
        Vezbac v = new Vezbac();
        v.setVezbacID(VezbacID);
        vv.opsteIzvrsenjeSO(v);
        return vv.getVezbac();
    }

    @Override
    public int izvrsenjeSO(OpstiDomenskiObjekat odo) {
        Vezbac v = (Vezbac) odo;
        vezbac = (Vezbac) DataBaseBroker.getDbb().vrati(v);        
        signal = DataBaseBroker.getDbb().getSignal();
        return signal;
    }

    @Override
    public boolean stanjeOperacije(int signal) {
        switch(signal)
        {
            case 9017:
                prikazi(signal, "Slog vracen");
                return true;
            case 9018:
                prikazi(signal, "Slog ne moze da bude vracen");
                return false;
            default:
                return false;
        }
    }

    

}
